package pl.wroc.pwr.nn;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Random;


public class TrainingVectors {

	private ArrayList<LabeledVector> sequence = new ArrayList<LabeledVector>();
	
	public TrainingVectors() {
		
	}
	
	public TrainingVectors(TrainingVectors vectors) {
		sequence = new ArrayList<LabeledVector>(vectors.sequence);
	}
	
	public LabeledVector detachRandomVector() {
		Random random = new Random(Calendar.getInstance().getTimeInMillis());
		int r = random.nextInt(sequence.size());
		return sequence.remove(r);
	}
	
	public boolean isEmpty() {
		return sequence.isEmpty();
	}
	
	public void add(LabeledVector vector) {
		sequence.add(vector);
	}
	
	public ArrayList<String> getLabels() {
		ArrayList<String> result = new ArrayList<String>();
		for (LabeledVector vec : sequence) {
			if (!result.contains(vec.getLabel())) {
				result.add(vec.getLabel());
			}
		}
		return result;
	}
}
